clear
log using "\\file\UsersW$\wrr15\Home\My Documents\My Files\ATANDA AKINWANDE\BCD PAPER\HEALTH ECONOMICS revision\NEW DATA AND PROGRAMS (20171021)\OnlineAppendix.smcl", replace
use "\\file\UsersW$\wrr15\Home\My Documents\My Files\ATANDA AKINWANDE\BCD PAPER\HEALTH ECONOMICS revision\NEW DATA AND PROGRAMS (20171021)\BCD_dataset_09_11_2017", clear

replace lhl = log(lhl)
xtset cid year

///PURT - LHL variables//
foreach v of varlist (lhl phpnh lprod prod k pop14 pop65 male llex lex linfmo infmo ///
                      ltobaco tobaco lalcohc alcohc gdpg) {
multipurt `v', lags(2)
}



///Swamy (1970) RCM - LHL//

xtrc lhl lprod k pop14 pop65 male llex linfmo ltobaco lalcohc gdpg, vce(conventional)

///Pesaran and Yamagata Delta Test (2008) - LHL//
mixed lhl lprod k pop14 pop65 male llex linfmo ltobaco lalcohc gdpg || cid: lprod, cov(unstruct)
estimates store Full 
mixed lhl lprod k pop14 pop65 male llex linfmo ltobaco lalcohc gdpg || cid: 

lrtest Full


///Swamy (1970) - PHPNH//
xtrc phpnh prod pop14 pop65 male lex infmo tobaco alcohc gdpg, vce(conventional)

///Pesaran and Yamagata Delta Test (2008) - PHPNH//
mixed phpnh prod pop14 pop65 male lex infmo tobaco alcohc gdpg || cid: prod, cov(unstruct)
estimates store Full 
mixed phpnh prod pop14 pop65 male lex infmo tobaco alcohc gdpg || cid: 

lrtest Full



///Westlund (2007) Cointegration Test///
// Unfortunately, we could not run these tests because we received the error message:
// "No more than 6 covariates can be specified"

//xtwest lhl lprod k pop14 pop65 male llex linfmo, lags(1 3) leads(0 2) trend

//xtectest lhl lprod k pop14 pop65 male llex linfmo, lags(1 3) leads(0 2) trend

//Ditzen's (2016) recursive correction for small sample bias
//Unfortunately when we attempted to estimate the following model
//xtdcce2 lhl lprod k pop14 pop65 male llex linfmo , cr(_all) reportc trend recursive
// we obtained the following error message 
// "More variables (459) than observations (356)."


//Pedroni Coinetgration Test//
// NOTE: We have to estimate the Model (7) specification rather than the Model (9) ///
// specification because when we run the latter we receive the following error message:
// "The number of regressors can't exceed seven"

xtpedroni lhl lprod k pop14 pop65 male llex linfmo, nopdols extraobs lagselect(aic)

xtpedroni phpnh prod k pop14 pop65 male lex infmo, nopdols extraobs lagselect(aic)


